#include <iostream>

using std::cout;
using std::endl;

class Base
{
public:
    Base(int base = 0)
    : _number(base)
    {
        cout << "Base(int = 0)" << endl;
    }

    virtual
    void print() 
    {
        cout << "Base::_number = " << _number << endl;
    }

    ~Base()
    {
        cout << "~Base()" << endl;
    }
/* private: */
protected:
    int _number;
};

class Derived
: public Base
{
public:
    Derived(int base = 0, int num = 0)
    : Base(base)
    , _number(num)
    {
        cout << "Derived(int = 0)" << endl;
    }

    /* void print() */ 
    virtual
    void print(int x)
    {
        cout << "形参x = " << x << endl;
        cout << "基类中吸收的_number = " << Base::_number << endl;
        cout << "_number = " << _number << endl;
    }

    ~Derived()
    {
        cout << "~Derived()" << endl;
    }
private:
    int _number;
};

void test()
{
    Base base(10);
    base.print();

    cout << endl << endl;
    Derived derived(111, 222);
    /* Base::print();//error */
    derived.Base::print();
    derived.print(12345);
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

